package com.hkyp.ss.course.provider.model;


import com.hkyp.ss.course.provider.model.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;

/**
 * 回复表
 *
 *  包含：
 *   二级评论
 *
 *
 */
@Data
@Entity
@Table(
        indexes = {
                @Index(columnList = "status",name = "statusIndex"),
                //常做查询条件的列加索引
                @Index(columnList = "parentId",name = "parentIdIndex")
        }
)
@DynamicUpdate
@DynamicInsert
@EqualsAndHashCode(callSuper=true)
public class Reply extends BaseEntity {


    /**
     * 父id
     * 评论表id
     */
    private Long parentId;

    /**
     * 用户id
     * 评论的发起者
     */
    private Long fromId;

    /**
     * 用户id
     * 评论的目标用户
     */
    private Long toId;


    /**
     * 回复内容
     *
     * 限制长度最长300字
     */
    @Column(length = 300)
    private String replyMsg;


    /**
     * 踩数
     */
    private Integer userDislike = 0;

    /**
     * 点赞数
     */
    private Integer userLike = 0;


    /**
     * 课评状态
     * 默认值为1
     * 0：正常；1：删除
     */
    @Column(name = "status", columnDefinition = "tinyint")
    private Integer status = 0;

}
